<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>售后服务</title>
<meta name="author" content="BIZ Team" />
<meta name="copyright" content="BIZ" />
<link href="${base}/resources/shop/css/common.css" rel="stylesheet" type="text/css" />
<link href="${base}/resources/shop/css/product.css" rel="stylesheet" type="text/css" />
<link href="${base}/resources/shop/css/consultation.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="${base}/resources/shop/js/jquery.js"></script>
<script type="text/javascript" src="${base}/resources/shop/js/public.js"></script>
<script type="text/javascript" src="${base}/resources/shop/js/common.js"></script>
<script type="text/javascript" src="${base}/resources/shop/js/common_another.js"></script>
<script type="text/javascript" src="/resources/shop/js/bootstrap.min.js"></script>
<link href="${base}/resources/shop/css/customer.css" rel="stylesheet" type="text/css" />
<link href="${base}/resources/shop/css/customerService.css" rel="stylesheet" type="text/css" />
<link href="${base}/resources/shop/css/bootstrap.min.css" rel="stylesheet">
<!-- 顶部的CSS样式 -->
<link href="${base}/resources/shop/css/head.css" rel="stylesheet">
<link href="${base}/resources/shop/css/home.css" rel="stylesheet">
<!-- 底部的CSS样式 -->
<link href="${base}/resources/shop/css/footer.css" rel="stylesheet">
<!-- 自己定义的CSS样式 -->
<link href="${base}/resources/shop/css/common_product.css" rel="stylesheet">
<script type="text/javascript">
</script>
</head>
<body>
	[#include "/shop/include/ng_header.ftl" /]
	<div class="container consultation">
		<div class="span24 last">
			<div class="path">
				<ul>
					<li>
						<a href="${base}/">${message("shop.path.home")}</a>
					</li>
					<li>
						<a href="${base}${product.path}">${abbreviate(product.name, 30)}</a>
					</li>
					<li>预约766售后服务</li>
				</ul>
			</div>
			<div class="afterSales">
				<div class="afterSales-left">
					<div class="afterSales-logo">
						<img src="${base}/resources/shop/images/afterSales-logo.png"/>
						<span class="afterSales-sanjiao"></span>
					</div>
					<div class="thank-message">
						<ul>
							<li class="thank-messag-h">尊敬的<span>[#if member.name==null]用户[#else]${member.name}[/#if]</span>,您好!</li>
							<li class="thank-messag-c">
								<p>[#if list?size>0]${list.get(0).serviceContent}[/#if]
								</p>
							</li>
						</ul>
					</div>
				</div>
				<div class="afterSales-right">
					<div class="company-message">
						<p>[#if list?size>0]${list.get(0).promiseContent}[/#if]</p>
					</div>
					<div class="serve-message">
						<div class='serve-reminder'>您需要<span>登录</span>才能进行售后预约操作！</div>
						<textarea id='textarea' placeholder='请输入售后服务事项：' [#if member==null]readonly="readonly"[/#if]></textarea>
						<div class="serve-btn">
							<button class='btn-submit'>确认</button><button class='btn-cancel'>取消</button>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<!--预约成功弹出-->
	<div class="afterSales-tanchu" style='position: fixed;width: 100%;height:100%;background-color: rgba(51,51,51,0.6);display:none;top:0px;z-index:10;'>
		<ul>
			<li class="afterSales-tanchu-t">恭喜您成功预约！</li>
			<li class="afterSales-tanchu-c">感谢<span>${member.name}</span>的信任，请保持通信畅通，766智能家预约售后服务人员将尽快与您联系。</li>
			<li><img src="${base}/resources/shop/images/logo.png"/></li>
		</ul>
	</div>
	[#include "/shop/include/ng_footer.ftl" /]
</body>

<script type="text/javascript">
	//取消
	$('.btn-cancel').on('click',function(){
		$('#textarea').val(''); 
	});
	//确定
	$('.btn-submit').on('click',function(){
		if($('#textarea').val()==''){
			return;
		}
		var content = $("#textarea").val();
		$.ajax({
		    url:"${base}/shops/customerService/add.jhtml",    //请求的url地址
		    dataType:"json",   //返回格式为json
		    data:{"content":content},    //参数值
		    type:"GET",   //请求方式
		    success:function(msg){
		        //请求成功时处理
				$('.afterSales-tanchu').fadeIn();
				setTimeout(function(){
					$('#textarea').val(''); 
					$('.afterSales-tanchu').fadeOut();
				},2500);
		    },
		    error:function(){
		        //请求出错处理
		    }
		});

	});
	//判断是否登陆
	if (!$.checkLogin()) {
		$(".btn-submit").attr("class","hidden");
		$(".btn-cancel").attr("class","hidden");
		$('.serve-reminder').show();
		$('#textarea').attr('placeholder','');
		//$.redirectLogin(window.location.pathname, "登录后才能进行售后预约！");
	}
	$('.serve-reminder span').click(function(){
		$.redirectLogin(window.location.pathname,"");		
	});
</script>
</html>